// Copyright (C) Kumo inc. and its affiliates.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//


#include <gtest/gtest.h>
#include <pollux/connectors/hive/hive_connector_split.h>
#include <pollux/exec/exchange.h>
#include <pollux/exec/split.h>

namespace kumo::pollux::exec {

TEST(SplitToStringTest, remoteSplit) {
  Split split{std::make_shared<RemoteConnectorSplit>("test")};
  ASSERT_EQ("Split: [Remote: test] -1", split.toString());

  split.groupId = 7;
  ASSERT_EQ("Split: [Remote: test] 7", split.toString());
}

TEST(SplitToStringTest, hiveSplit) {
  Split split{std::make_shared<connector::hive::HiveConnectorSplit>(
      "hive",
      "path/to/file.parquet",
      dwio::common::FileFormat::PARQUET,
      7,
      100)};
  ASSERT_EQ("Split: [Hive: path/to/file.parquet 7 - 100] -1", split.toString());

  split.groupId = 7;
  ASSERT_EQ("Split: [Hive: path/to/file.parquet 7 - 100] 7", split.toString());
}
} // namespace kumo::pollux::exec
